/*
 *  Copyright (c) 2008 shingoki
 *
 *  This file is part of jpropeller, see http://code.google.com/p/jpropeller/
 *
 *    jpropeller is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    jpropeller is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with jpropeller. If not, see <http://www.gnu.org/licenses/>.
 *    
 */
package org.jpropelleralt.path;

import org.jpropelleralt.reaction.Reaction;
import org.jpropelleralt.ref.Ref;
import org.jpropelleralt.ref.impl.PathRef;
import org.jpropelleralt.universe.Universe;

/**
 * A path that can be iterated via a {@link PathIterator}
 * @param <T>		The type of data in the final {@link Ref} reached by the path
 */
public interface Path<T> {
	/**
	 * Iterate the {@link Path}
	 * This should be called while the {@link Universe} is locked,
	 * and the iterator should be completely consumed while the
	 * {@link Universe} is still locked. This is normally the case
	 * anyway - for example when a {@link Path} is used by a {@link PathRef},
	 * which always follows the {@link Path} when a {@link Reaction} is applying,
	 * or the {@link PathRef} is being written.
	 * @return			An iterator through the path.
	 */
	public PathIterator<T> iterator();
	
}